﻿<phone:PhoneApplicationPage 
    x:Class="CalciumTemplateApp.DashboardView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:c="clr-namespace:Outcoder.UI.Xaml;assembly=Outcoder.Calcium.WindowsPhone"
    xmlns:controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls"
    xmlns:local="clr-namespace:CalciumTemplateApp" 
    mc:Ignorable="d" 
    d:DesignWidth="480" d:DesignHeight="768"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait" Orientation="Portrait"
    shell:SystemTray.IsVisible="{Binding AppSettings.SystemTrayVisible, FallbackValue=true}"
    c:VisualStateUtility.VisualState="{Binding VisualState}"
    Style="{StaticResource PageStyle}">

    <Grid x:Name="LayoutRoot" Background="Transparent">
        <phone:Pivot Title="{Binding Resources.Instance.AppTitle, 
                                  Source={StaticResource Resources}, 
                                  FallbackValue=untitled}" 
                        ItemsSource="{Binding ChildViewModels}"
                        SelectedItem="{Binding SelectedViewModel, Mode=TwoWay}">
            <phone:Pivot.HeaderTemplate>
                <DataTemplate>
                    <TextBlock Text="{Binding Title}" 
                               Style="{StaticResource PhoneTextTitle1Style}" Margin="0" />
                </DataTemplate>
            </phone:Pivot.HeaderTemplate>
            <phone:Pivot.ItemTemplate>
                <DataTemplate>
                    <c:TemplateSelectorControl 
                        Content="{Binding}" 
                        HorizontalAlignment="Stretch"
                        HorizontalContentAlignment="Stretch" 
                        VerticalContentAlignment="Stretch"
                        Margin="12,0,0,0">
                        <c:TemplateSelectorControl.Resources>
                            <DataTemplate x:Key="AboutViewModel">
                                <local:AboutView DataContext="{Binding}" />
                            </DataTemplate>
                            <DataTemplate x:Key="OptionsViewModel">
                                <local:OptionsView DataContext="{Binding}" />
                            </DataTemplate>
                            <DataTemplate x:Key="HelpViewModel">
                                <local:HelpView DataContext="{Binding}" />
                            </DataTemplate>
                        </c:TemplateSelectorControl.Resources>
                    </c:TemplateSelectorControl>
                </DataTemplate>
            </phone:Pivot.ItemTemplate>
        </phone:Pivot>
    </Grid>
 
</phone:PhoneApplicationPage>